package com.zzyl.nursing.controller.member;


import com.github.pagehelper.PageHelper;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/member/orders/project")
@Api(tags = "服务分页查询接口")
public class MemberProjectControlller  extends BaseController {

    @Autowired
   private INursingProjectService nurseringProjectService;

    @GetMapping("/page")
    @ApiOperation("护理项目分页查询")
    public TableDataInfo<List<NursingProject>> page(NursingProject nursingProject,
                             @RequestParam(defaultValue = "1") int pageNum,
                             @RequestParam(defaultValue = "10") int pageSize){

        PageHelper.startPage(pageNum, pageSize);
        List<NursingProject> list = nurseringProjectService.selectNursingProjectList(nursingProject);
        return getDataTable(list);
    }

    @GetMapping("/{id}")
    @ApiOperation("获取护理项目详细信息")
    public R<NursingProject> getInfo(@ApiParam("护理项目ID") @PathVariable("id") Long id)
    {
        return R.ok(nurseringProjectService.selectNursingProjectById(id));
    }


}
